﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
using System.Text;
using System.IO;

namespace Gacn.ControleAlunos.WebApplication
{
    public partial class Coxinha : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            try
            {
                FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(@"D:\Hosting\8321933\html\bin\Gacn.ControleAlunos.Library.dll");
            }
            catch
            {
                try
                {
                    
                    //Library DLL
                    FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(@"C:\inetpub\HPGACN_SITE\bin\Gacn.ControleAlunos.Library.dll");
                    DateTime dt = File.GetLastWriteTimeUtc(@"C:\inetpub\HPGACN_SITE\bin\Gacn.ControleAlunos.Library.dll");


                    sb.Append("<h3>");
                    sb.Append(fvi.InternalName);
                    sb.Append("</h3>");
                    sb.Append("Debug Version: ");
                    sb.Append(fvi.IsDebug);
                    sb.AppendLine("<br/>");
                    sb.AppendLine("Modified: ");
                    sb.Append(dt.AddHours(-3).ToLongDateString());
                    sb.Append(" at ");
                    sb.Append(dt.AddHours(-3).ToLongTimeString());


                    //WebApplication DLL
                    fvi = FileVersionInfo.GetVersionInfo(@"C:\inetpub\HPGACN_SITE\bin\Gacn.ControleAlunos.WebApplication.dll");
                    dt = File.GetLastWriteTimeUtc(@"C:\inetpub\HPGACN_SITE\bin\Gacn.ControleAlunos.WebApplication.dll");

                    sb.Append("<h3>");
                    sb.Append(fvi.InternalName);
                    sb.Append("</h3>");
                    sb.Append("Debug Version: ");
                    sb.Append(fvi.IsDebug);
                    sb.AppendLine("<br/>");
                    sb.AppendLine("Modified: ");
                    sb.Append(dt.AddHours(-3).ToLongDateString());
                    sb.Append(" at ");
                    sb.Append(dt.AddHours(-3).ToLongTimeString());

                    //Connection String

                    sb.Append("<h3>General app info</h3>");

                    if (Gacn.ControleAlunos.Library.DataAccess.Util.GetConnection().DataSource.Contains("8321933"))
                        sb.Append("Connection String set to Production");
                    else
                        if(Gacn.ControleAlunos.Library.DataAccess.Util.GetConnection().DataSource.Contains("sqltraining"))
                            sb.Append("Connection String set to Ratification");
                        else
                            sb.Append("Connection String set to Unknown");




                    Response.Write(sb.ToString());
                }
                catch
                {
                    Response.Write("Indefinido");
                }
            }

        }
    }
}